<template>
  <div class="app-container">
    <!-- 搜索 -->
    <el-card class="search-card">
      <el-form :model="queryParams" size="small" label-width="78px" class="formBox">
        <el-row :gutter="0">
          <el-col :span="5">
            <el-form-item label="姓名" prop="gradeId">
              <el-input placeholder="请输入姓名" v-model="queryParams.status"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="身份证号" prop="gradeId">
              <el-input
                placeholder="请输入身份证号"
                v-model="queryParams.status"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="校区" prop="classId">
              <el-select
                v-model="queryParams.classId"
                placeholder="请选择校区"
                @keyup.enter.native="handleQuery"
                style="width: 100%"
              >
                <el-option
                  v-for="(item, index) in campusList"
                  :key="index"
                  :value="item.id"
                  :label="item.className"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="年级" prop="gradeId">
              <el-select
                v-model="queryParams.classId"
                placeholder="请选择校区"
                @keyup.enter.native="handleQuery"
                style="width: 100%"
              >
                <el-option
                  v-for="(item, index) in campusList"
                  :key="index"
                  :value="item.id"
                  :label="item.className"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="班级" prop="gradeId">
              <el-select
                v-model="queryParams.status"
                placeholder="请选择使用状态"
                @keyup.enter.native="handleQuery"
                style="width: 100%"
              >
                <el-option value="1" label="开启"></el-option>
                <el-option value="2" label="关闭"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="缴费状态" prop="gradeId">
              <el-select
                v-model="queryParams.status"
                placeholder="请选择缴费状态"
                @keyup.enter.native="handleQuery"
                style="width: 100%"
              >
                <el-option value="1" label="开启"></el-option>
                <el-option value="2" label="关闭"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="请假状态" prop="gradeId">
              <el-select
                v-model="queryParams.status"
                placeholder="请选择餐别类型"
                @keyup.enter.native="handleQuery"
                style="width: 100%"
              >
                <el-option value="1" label="开启"></el-option>
                <el-option value="2" label="关闭"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="餐别类型" prop="gradeId">
              <el-select
                v-model="queryParams.status"
                placeholder="请选择餐别类型"
                @keyup.enter.native="handleQuery"
                style="width: 100%"
              >
                <el-option value="1" label="开启"></el-option>
                <el-option value="2" label="关闭"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="餐标类型" prop="gradeId">
              <el-select
                v-model="queryParams.status"
                placeholder="请选择支付状态"
                @keyup.enter.native="handleQuery"
                style="width: 100%"
              >
                <el-option value="1" label="开启"></el-option>
                <el-option value="2" label="关闭"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="请假日期" prop="gradeId">
              <el-date-picker
                v-model="queryParams.value1"
                type="daterange"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="16">
            <el-form-item>
              <div class="dis aic">
                <div class="flex_1"></div>
                <el-button
                  type="primary"
                  icon="el-icon-search"
                  size="mini"
                  @click="handleQuery"
                >
                  搜索
                </el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">
                  重置
                </el-button>
              </div>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <el-card class="search-card">
      <el-row :gutter="10" class="mb8">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="buttonMethods(1)"
          v-hasPermi="['campus:unpaid:export']"
        >
          添加
        </el-button>
        <right-toolbar
          :showSearch.sync="showSearch"
          @queryTable="getList"
        ></right-toolbar>
      </el-row>
    </el-card>
    <el-card class="table-card">
      <el-table :data="dataList">
        <el-table-column label="姓名" align="center" prop="idCardNumber" />
        <el-table-column label="身份证号" align="center" prop="idCardNumber" />
        <el-table-column label="校区" align="center" prop="name" />
        <el-table-column label="年级" align="center" prop="idCardNumber" />
        <el-table-column label="班级" align="center" prop="idCardNumber" />
        <el-table-column label="团餐计划" align="center" prop="idCardNumber" />
        <el-table-column label="餐别类型" align="center" prop="idCardNumber" />
        <el-table-column label="餐标类型" align="center" prop="idCardNumber" />
        <el-table-column label="请假日期" align="center" prop="idCardNumber" />
        <el-table-column label="请假类型" align="center" prop="idCardNumber" />
        <el-table-column label="请假状态" align="center" prop="idCardNumber" />
        <el-table-column label="缴费状态" align="center" prop="idCardNumber" />
        <el-table-column label="退款金额" align="center" prop="idCardNumber" />
        <el-table-column label="创建时间" align="center" prop="idCardNumber" />
        <el-table-column label="创建人" align="center" prop="idCardNumber" />
        <el-table-column label="操作" align="center" width="260px">
          <template slot-scope="scope">
            <el-button
              type="warning"
              size="mini"
              @click="buttonMethods(3, scope.row)"
              v-hasPermi="['campus:grade:edit']"
              >查看
            </el-button>
            <el-button
              type="danger"
              size="mini"
              @click="buttonMethods(4, scope.row)"
              v-hasPermi="['campus:grade:remove']"
              >删除
            </el-button>
            <el-button
              type="danger"
              size="mini"
              @click="buttonMethods(5, scope.row)"
              v-hasPermi="['campus:grade:remove']"
            >
              取消请假
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </el-card>
    <el-dialog :title="title" :visible.sync="status" width="40%" append-to-body>
      <el-form ref="form" :model="queryForm" label-width="95px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="校区名称" prop="gradeId" style="width: 100%">
              <el-select
                v-model="queryParams.gradeId"
                placeholder="请选择校区名称"
                style="width: 100%"
              >
                <el-option
                  v-for="(item, index) in gradeList"
                  :key="index"
                  :value="item.id"
                  :label="item.gradeName"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="团餐计划" prop="gradeId" style="width: 100%">
              <el-select
                v-model="queryForm.gradeId"
                placeholder="请选择团餐计划"
                style="width: 100%"
              >
                <el-option
                  v-for="(item, index) in gradeList"
                  :key="index"
                  :value="item.id"
                  :label="item.gradeName"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="餐别类型" prop="gradeId" style="width: 100%">
              <el-select
                v-model="queryForm.gradeId"
                placeholder="请选择餐别类型"
                style="width: 100%"
              >
                <el-option
                  v-for="(item, index) in gradeList"
                  :key="index"
                  :value="item.id"
                  :label="item.gradeName"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="学生姓名" prop="gradeId" style="width: 100%">
              <div class="dis aic">
                <el-select
                  v-model="queryForm.gradeId"
                  placeholder="请选择学生姓名"
                  style="width: 100%"
                  disabled="true"
                >
                  <el-option
                    v-for="(item, index) in gradeList"
                    :key="index"
                    :value="item.id"
                    :label="item.gradeName"
                  ></el-option>
                </el-select>
                <div
                  style="padding: 0 20px; font-size: 24px; color: #2f54eb"
                  @click="buttonMethods(6)"
                >
                  <i class="el-icon-circle-plus-outline"></i>
                </div>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="请假日历" prop="gradeName" class="is-required">
              <el-date-picker
                v-model="queryForm.value"
                type="dates"
                placeholder="选择日期"
                class="width_100"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="备注" prop="gradeName">
              <el-input
                type="textarea"
                v-model="queryForm.gradeName"
                placeholder="请输入备注"
                maxlength="200"
                :rows="2"
                show-word-limit
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="buttonMethods(2)">确 定</el-button>
        <el-button @click="buttonMethods(3)">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="title" :visible.sync="selectStatus" width="60%" append-to-body>
      <el-form ref="form" :model="queryForm" label-width="95px">
        <el-row>
          <el-col :span="6">
            <el-form-item label="年级" prop="gradeId" style="width: 100%">
              <el-select
                v-model="queryParams.gradeId"
                placeholder="请选择年级"
                style="width: 100%"
              >
                <el-option
                  v-for="(item, index) in gradeList"
                  :key="index"
                  :value="item.id"
                  :label="item.gradeName"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="班级" prop="gradeId" style="width: 100%">
              <el-select
                v-model="queryForm.gradeId"
                placeholder="请选择班级"
                style="width: 100%"
              >
                <el-option
                  v-for="(item, index) in gradeList"
                  :key="index"
                  :value="item.id"
                  :label="item.gradeName"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="姓名" prop="gradeId" style="width: 100%">
              <el-input
                v-model="queryForm.gradeName"
                placeholder="请输入姓名"
                show-word-limit
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="身份证号" prop="gradeId" style="width: 100%">
              <el-input v-model="queryForm.gradeName" placeholder="请输入身份证号" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item>
              <div class="dis aic">
                <div class="flex_1"></div>
                <el-button
                  type="primary"
                  icon="el-icon-search"
                  size="mini"
                  @click="handleQuery"
                >
                  搜索
                </el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">
                  重置
                </el-button>
              </div>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-table :data="dataList">
        <el-table-column type="selection" width="55" />
        <el-table-column label="学生姓名" align="center" prop="idCardNumber" />
        <el-table-column label="身份证号" align="center" prop="name" />
        <el-table-column label="性别" align="center" prop="idCardNumber" />
        <el-table-column label="所属校区" align="center" prop="idCardNumber" />
        <el-table-column label="年级" align="center" prop="idCardNumber" />
        <el-table-column label="班级" align="center" prop="idCardNumber" />
        <el-table-column label="订单使用状态" align="center" prop="idCardNumber" />
        <el-table-column label="所属折扣" align="center" prop="idCardNumber" />
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="buttonMethods(2)">确 定</el-button>
        <el-button @click="buttonMethods(3)">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { listGrade } from "@/api/campus/grade";
import { listClassManage } from "@/api/campus/classManage";

export default {
  name: "personLeave",
  data() {
    return {
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 1,
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      status: false,
      selectStatus: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      dataList: [
        {
          status: 1,
          name: "1",
        },
        {
          name: "2",
          status: 2,
        },
      ],
      campusList: [],
      gradeList: [],
      queryForm: {},
    };
  },
  created() {},
  activated() {},
  methods: {
    // 列表
    getList() {},
    /**
     * 按钮相关的方法集合
     *
     * @returns {void}
     */
    buttonMethods(options, value) {
      // 添加
      if (options == 1) {
        this.title = "添加学生请假";
        this.status = true;
      }
      //关闭
      else if (options == 2) {
      }
      //查看
      else if (options == 3) {
      }
      // 删除
      else if (options == 4) {
      }
      // 取消请假
      else if (options == 5) {
      } else if (options == 6) {
        this.title = "选择学生";
        this.selectStatus = true;
      }
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 导出
    handleExport() {
      this.download(
        "",
        {
          ...this.queryParams,
        },
        `餐别管理导出.xlsx`
      );
    },
  },
};
</script>
<style>
.formBox >>> .el-form-item--small.el-form-item {
  margin-bottom: 0px !important;
}

.formBox >>> .el-form-item__label {
  font-size: 12px !important;
  padding: 0 !important;
}
</style>
